import { v4 as uuidv4 } from 'uuid';
export const getUUId = () => {
  //获取本地存储的uuidtoken
  let uuid_token = localStorage.getItem('UUIDTOKEN')    
  //如果本地存储中没有uuid 
  if (!uuid_token) {
    //使用uuidv4生成 uuid,uuidv4:随机生成一串字符作为token

    uuid_token = uuidv4()
    //本地存储uuidtoken
    localStorage.setItem('UUIDTOKEN',uuid_token)
  }
  // 函数返回值为uuid
  return uuid_token
}